package orthoplanner.com.google.code.eventhandlers;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JSlider;

import orthoplanner.com.google.code.ui.ImageViewer;


public class ImageFreezeHandler extends MouseAdapter {
	JSlider slScale, slRotation;
	JButton sReset, rReset;

	public ImageFreezeHandler(JSlider slScale, JSlider slRotation,
			JButton sReset, JButton rReset) {
		super();
		this.slScale = slScale;
		this.slRotation = slRotation;
		this.sReset = sReset;
		this.rReset = rReset;
		// mouseClicked(arg0);
	}

	@Override
	public void mousePressed(MouseEvent e) {
		ImageViewer.FREEZE_IMAGE = !((JCheckBox) e.getSource()).isSelected();
		System.out.println(ImageViewer.FREEZE_IMAGE);
		if (ImageViewer.FREEZE_IMAGE) {
			slScale.setEnabled(false);
			slRotation.setEnabled(false);
			sReset.setEnabled(false);
			rReset.setEnabled(false);
		} else {
			slScale.setEnabled(true);
			slRotation.setEnabled(true);
			sReset.setEnabled(true);
			rReset.setEnabled(true);

		}

	}

}
